package cn.gzsxt.music.service.impl;

import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import cn.gzsxt.music.mapper.UserMapper;
import cn.gzsxt.music.query.UserQueryObject;
import cn.gzsxt.music.service.UserService;

@Service
public class UserServiceImpl implements UserService {
	
	@Autowired
	private UserMapper mapper;

	@Override
	public Map<String, Object> selectUserListByQo(UserQueryObject qo) {
		
		Map<String, Object> dataGridMap = new HashMap<>();
		dataGridMap.put("total", mapper.selectUserTotalByQo(qo));
		dataGridMap.put("rows", mapper.selectUserListByQo(qo));
		
		return dataGridMap;
	}
	
	@Override
	public int insert(Map<String, Object> params) {
		return mapper.insert(params);
	}

	@Override
	public int deleteUserById(String[] user_ids) {
		Map<String, Object> userIdMap = new HashMap<>();
		userIdMap.put("user_ids", user_ids);
		return mapper.deleteUserById(userIdMap);
	}

	@Override
	public int update(Map<String, Object> params) {
		
		return mapper.update(params);
	}

	@Override
	public List<Map<String, Object>> checkByUName(String user_name) {
		
		return mapper.checkByUname(user_name);
	}

	
}
